Reentrant covers for OS subroutines

Contents|Index|Previous|Next
Reentrant covers for OS subroutines

Since the system subroutines are used by other library routines that require reentrancy, libc.a provides cover routines (for example, the reentrant version of fork is _fork_r). These cover routines are consistent with the other reentrant subroutines in this library, and achieve reentrancy by using a reserved global data block (see Reentrancy for more discussion). The following discussion describes the routines.

- _open_r
A reentrant version of open. It takes a pointer to the global data block which holds errno.

    int _open_r(void *reent,
       const char *file, int flags, int mode);

- _close_r
A reentrant version of close. It takes a pointer to the global data block which holds errno.

    int _close_r(void *reent, int fd);

- _lseek_r
A reentrant version of lseek. It takes a pointer to the global data block which holds errno.

    off_t _lseek_r(void *reent,
       int fd, off_t pos, int whence);

- _read_r
A reentrant version of read. It takes a pointer to the global data block which holds errno.

    long _read_r(void *reent,
       int fd, void *buf, size_t cnt);

- _write_r
A reentrant version of write. It takes a pointer to the global data block which holds errno.

    long _write_r(void *reent,
       int fd, const void *buf, size_t cnt);

- _fork_r
A reentrant version of fork. It takes a pointer to the global data block which holds errno.

    int _fork_r(void *reent);

- _wait_r
A reentrant version of wait. It takes a pointer to the global data block which holds errno.

    int _wait_r(void *reent, int *status);

- _stat_r
A reentrant version of stat. It takes a pointer to the global data block which holds errno.

    int _stat_r(void *reent,
       const char *file, struct stat *pstat);

- _fstat_r
A reentrant version of fstat. It takes a pointer to the global data block which holds errno.

    int _fstat_r(void *reent, int fd,
       struct stat *pstat);

- _link_r
A reentrant version of link. It takes a pointer to the global data block which holds errno.

    int _link_r(void *reent,
       const char *old, const char *new);

- _unlink_r
A reentrant version of unlink. It takes a pointer to the global data block which holds errno.

    int _unlink_r(void *reent, const char *file);

- _sbrk_r
A reentrant version of sbrk. It takes a pointer to the global data block which holds errno.

    char *_sbrk_r(void *reent, size_t incr);

Top|Contents|Index|Previous|Next